package cn.stylefeng.guns.modular.headers.controller;

import cn.stylefeng.guns.modular.headers.entity.QynPfcHeaders;
import cn.stylefeng.guns.modular.headers.pojo.request.QynPfcHeadersRequest;
import cn.stylefeng.guns.modular.headers.service.QynPfcHeadersService;
import cn.stylefeng.roses.kernel.jwt.api.JwtApi;
import cn.stylefeng.roses.kernel.jwt.api.pojo.config.JwtConfig;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;

/**
 * 交易中心自动获取headers控制器
 *
 * @author 我是谭先生🐻
 * @date 2025/03/12 11:22
 */
@RestController
@ApiResource(name = "交易中心自动获取headers")
public class QynPfcHeadersController {

    @Resource
    private QynPfcHeadersService qynPfcHeadersService;

    /**
     * 添加
     *
     * @author 我是谭先生🐻
     * @date 2025/03/12 11:22
     */
    @PostResource(name = "添加", path = "/qynPfcHeaders/add",requiredPermission = false,requiredLogin = false)
    public ResponseData<QynPfcHeaders> add(@RequestBody @Validated(QynPfcHeadersRequest.add.class) QynPfcHeadersRequest qynPfcHeadersRequest) {
        qynPfcHeadersService.add(qynPfcHeadersRequest);
        return new SuccessResponseData<>();
    }


    /**
     * 删除
     *
     * @author 我是谭先生🐻
     * @date 2025/03/12 11:22
     */
    @PostResource(name = "删除", path = "/qynPfcHeaders/delete")
    public ResponseData<?> delete(@RequestBody @Validated(QynPfcHeadersRequest.delete.class) QynPfcHeadersRequest qynPfcHeadersRequest) {
        qynPfcHeadersService.del(qynPfcHeadersRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 编辑
     *
     * @author 我是谭先生🐻
     * @date 2025/03/12 11:22
     */
    @PostResource(name = "编辑", path = "/qynPfcHeaders/edit")
    public ResponseData<?> edit(@RequestBody @Validated(QynPfcHeadersRequest.edit.class) QynPfcHeadersRequest qynPfcHeadersRequest) {
        qynPfcHeadersService.edit(qynPfcHeadersRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 查看详情
     *
     * @author 我是谭先生🐻
     * @date 2025/03/12 11:22
     */
    @GetResource(name = "查看详情", path = "/qynPfcHeaders/detail")
    public ResponseData<QynPfcHeaders> detail(@Validated(QynPfcHeadersRequest.detail.class) QynPfcHeadersRequest qynPfcHeadersRequest) {
        return new SuccessResponseData<>(qynPfcHeadersService.detail(qynPfcHeadersRequest));
    }

    /**
     * 获取列表
     *
     * @author 我是谭先生🐻
     * @date 2025/03/12 11:22
     */
    @GetResource(name = "获取列表", path = "/qynPfcHeaders/list")
    public ResponseData<List<QynPfcHeaders>> list(QynPfcHeadersRequest qynPfcHeadersRequest) {
        return new SuccessResponseData<>(qynPfcHeadersService.findList(qynPfcHeadersRequest));
    }

    /**
     * 获取列表（带分页）
     *
     * @author 我是谭先生🐻
     * @date 2025/03/12 11:22
     */
    @GetResource(name = "分页查询", path = "/qynPfcHeaders/page")
    public ResponseData<PageResult<QynPfcHeaders>> page(QynPfcHeadersRequest qynPfcHeadersRequest) {
        return new SuccessResponseData<>(qynPfcHeadersService.findPage(qynPfcHeadersRequest));
    }

}
